<?php
namespace cms\modules\v1\controllers;

use cms\modules\v1\models\userFund\WithdrawOrder;
use common\models\Functions;
use common\models\Status;
use Yii;
use yii\filters\auth\HttpHeaderAuth;
use yii\helpers\ArrayHelper;

class WithdrawController extends DefaultController
{
    public $modelClass = '';
    public function behaviors()
    {
        return ArrayHelper::merge(parent::behaviors(), [
            'authenticator' => [
                'class' =>  HttpHeaderAuth::className(),    //head头部验证
                'header' => 'access-token',
                'optional' => [

                ]
            ]
        ]);
    }
    public function actionList($page = 1, $size = 20) {
        if (Yii::$app->request->isGet) {
            return (new WithdrawOrder())->getListData($page, $size);
        }
    }
    public function actionSuccess() {
        if (Yii::$app->request->isPost) {
            return (new WithdrawOrder())->success();
        }
    }
    public function actionReject() {
        if (Yii::$app->request->isPost) {
            return (new WithdrawOrder())->reject();
        }
    }

    public function actionStatusMap() {
        if (Yii::$app->request->isGet) {
            return Functions::formatRestAPI(0, '', Status::WITHDRAW_STATUS_MAP);
        }
    }

    //获取体现金额汇总
    public function actionMoney() {
        if (Yii::$app->request->isGet) {
            return (new WithdrawOrder())->getMoney();
        }
    }

}
